<!-- 
  特授页面处理
-->
<script setup lang="ts">
import { useRoute } from 'vue-router'
import { ref, watch } from 'vue'
import routerIndex from '@/router/index'
// 个人积分
import GeRenJiFen from '@/views/cloudNetworkSecurity/GeRenJiFen/index.vue'
import GeRenJiFenDetails from '@/views/cloudNetworkSecurity/GeRenJiFen/GeRenJiFenDetails.vue'
// 装维人员画像
import HuaXiang from '@/views/zhuangweiBusiness/ZhuangWeiHuaXiang/index.vue'
import HuaXiangDetails from '@/views/zhuangweiBusiness/ZhuangWeiHuaXiang/HuaXiangDetails.vue'

const route = useRoute()
// 云网安全 - 个人积分 - 个人积分
const showGeRenJiFen = ref(false)
// 装维业务 - 装维工作量核算 - 工程师画像 - 装维人员画像
const showHuaXiang = ref(false)

const isShowFn = () => {
  const routerParh = route.path.split('/')
  showGeRenJiFen.value = false
  showHuaXiang.value = false
  switch (route.path.split('/').pop()) {
    case 'GeRenJiFen':
      showGeRenJiFen.value = true
      routerIndex.addRoute('BianGengCaoZuoGeRenJiFen', {
        path: `/${routerParh[1]}/${routerParh[2]}/${routerParh[3]}/Details`,
        name: 'GeRenJiFenDetails',
        meta: {
          title: '个人积分详情',
          keepAlive: true,
          hidden: false,
          isMulti: false,
          iframeComponent: false
        },
        component: GeRenJiFenDetails
      })
      break
    case 'ZhuangWeiRenYuanHuaXiang':
      showHuaXiang.value = true
      routerIndex.addRoute('ZhuangWeiGongZuoLiangHeSuanGongChengShiHuaXiang', {
        path: `/${routerParh[1]}/${routerParh[2]}/${routerParh[3]}/Details`,
        name: 'ZhuangWeiRenYuanHuaXiangDetails',
        meta: {
          title: '画像详情',
          keepAlive: true,
          hidden: false,
          isMulti: false,
          iframeComponent: false
        },
        component: HuaXiangDetails
      })
      break
    default:
      break
  }
  // console.log(route.path.split('/'))
}

watch(
  () => route.path,
  (newPath: any, oldPath: any) => {
    if (newPath !== oldPath) {
      isShowFn()
    }
    // console.log(newPath, oldPath)
  },
  { immediate: true, deep: true }
)
</script>
<template>
  <GeRenJiFen v-if="showGeRenJiFen"></GeRenJiFen>
  <HuaXiang v-if="showHuaXiang"></HuaXiang>
</template>
<style scoped lang="less"></style>
